package br.org.acessobrasil.portal.util;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages {
	private static final String BUNDLE_NAME = "hibernate";

	private static ResourceBundle RESOURCE_BUNDLE;
	static{
		try{
			RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
		}catch(Exception e){
			
		}
	}
	
	private static final ResourceBundle ACTION_NAMES = ResourceBundle
	.getBundle("ActionNames");

	private Messages() {
	}

	public static String getString(String key) {
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
	
	/**
	 * Retorna o nome da acao de forma mais inteligivel<br>
	 * Em ActionNames.properties
	 * @param key
	 * @return String nome traduzido da acao
	 */
	public static String getActionName(String key){
		try {
			return ACTION_NAMES.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
}
